package ObjectOutputStream;

import java.io.Serializable;

/*
    当对象需要被序列化时，需要实现Serializable接口
    同时为了防止对象的属性被修改从而造成序列化流找不到文件（因为序列化流找文件是通过序列号来找到的）
 */
public class Student implements Serializable {
    //序列号
    public static final long serialVersionUID =669484365l;
    private String name;
    private int age;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
